/**
 * author:Administrator
 * date:2016/1/4
 * desc:TODO
 */

'use strict';
var assert = require('assert');
var daoOrder = require('../dao/order.js');
var daoCnt = require('../dao/counter.js');

var biz = {};
module.exports = biz;

biz.reset = function*() {
  var retObj = yield daoCnt.setCounter(daoCnt.TypesEnum.orderid, 0);
  assert.equal(retObj, 0);
  return yield daoOrder.empty();
};

biz.newOrder = function*() {
  return yield daoOrder.addFreshOrder();
};

biz.payment = function*(oid) {
  return yield daoOrder.pay(oid);
};


